package com.atguigu.wordcount.groupcomparator;

import org.apache.hadoop.io.NullWritable;
import org.apache.hadoop.mapreduce.Reducer;

import java.io.IOException;

/**
 * @ClassName OrderReducer
 * @DeScription OrderReducer
 * @Author 剧情再美终是戏
 * @Date 2019/11/19 15:22
 * @Version 1.0
 **/
public class OrderReducer extends Reducer<Order, NullWritable, Order, NullWritable> {

    @Override
    protected void reduce(Order key, Iterable<NullWritable> values, Context context) throws IOException, InterruptedException {
        Double price = key.getPrice();
        for (NullWritable value : values) {
            if (!price.equals(key.getPrice())) {
               return;
            }
            context.write(key, value);
        }
    }
}
